using Proto;

namespace sgf.server
{
    public interface IOnStart;

    public interface IOnStartSystem : ISystemType
    {
        Task Run(IBusActor busActor, IContext context);
    }

    public abstract class OnStartSystem<T> : IOnStartSystem where T : IOnStart
    {
        public async Task Run(IBusActor busActor, IContext context)
        {
            await this.OnStart((T)busActor, context);
        }

        public abstract Task OnStart(T busActor, IContext context);

        public Type Type()
        {
            return typeof(T);
        }
    }
}